package main.nk.mygraph;

import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.view.mxGraph;
import javafx.application.Application;
import javafx.embed.swing.SwingNode;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.io.IOException;

public class Main1 extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws IOException {

        StackPane pane = new StackPane();
        Scene scene = new Scene(pane,600,600);

        mxGraph graph = new mxGraph();
        Object parent = graph.getDefaultParent();
        graph.getModel().beginUpdate();
        try{
            graph.insertVertex(parent,null,"",1,1,45,54,"shape=image;image=/images/bell.png");
            graph.insertVertex(parent,null,"shape",20,20,45,54,"shape=cloud");
        }finally {
            graph.getModel().endUpdate();
        }
        mxGraphComponent component = new mxGraphComponent(graph);
        component.setDragEnabled(false);
        SwingNode node = new SwingNode();
        node.setContent(component);


        pane.getChildren().add(node);
        stage.setScene(scene);
        stage.show();

    }
}
